<extend name="Public/base" />

<!-- 子导航 -->
<block name="sidebar">
	<include file="sidemenu" />
</block>

<block name="body">
	<!-- 标题 -->

	<!-- 按钮工具栏 -->
	<div class="cf">
		<div class="search-form fr cf">
			<div class="sleft">
				<div class="drop-down">
					<span id="sch-sort-txt" class="sort-txt" data="{$status}"><if condition="get_status_title($status) eq ''">所有<else/>{:get_status_title($status)}</if></span>
					<i class="arrow arrow-down"></i>
					<ul id="sub-sch-menu" class="nav-list hidden">
						<li>
							<a href="javascript:;" value="">客户姓名</a>
						</li>
						<li>
							<a href="javascript:;" value="1">客户类型</a>
						</li>
						<li>
							<a href="javascript:;" value="0">手机</a>
						</li>
						<li>
							<a href="javascript:;" value="2">跟进状态</a>
						</li>
					</ul>
				</div>
				<input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入标题文档">
				<a class="sch-btn" href="javascript:;" id="search" url="{:U('article/index','pid='.I('pid',0).'&cate_id='.$cate_id,false)}"><i class="btn-search"></i></a>
			</div>

		</div>
		<ul class="nav nav-tabs topnav pull-left">
			<li class="nav-tabs__title">客户</li>
			<li class="active">
				<a class="nav-link" href="/index?scope=all_own">全部客户</a>
			</li>
			<li class=" ">
				<a class="nav-link" href="/index?scope=my_own">我的客户</a>
			</li>
			<li class="">
				<a class="nav-link" href="/index?scope=my_assist">我协作的客户</a>
			</li>
		</ul>
		<div class="kh_fl">
			<div class="kh_fl_1">
				<label>客户分类：</label>
				<div>
					<div>
						<a class="" href="">全部</a>
						<a class="" href="">我的客户</a>
						<a class="" href="">我接受的协作客户</a>
						<a class="" href="">我发起的协作客户</a>
					</div>
				</div>
			</div>
			<div class="kh_fl_2">
				<label>客户类型：</label>
				<div>
					<div>
						<a class="active" href="">全部</a>
						<volist name=":C('CUSTOMER_CATEGORY')" id="vo" key="k">
							<a class="" href="{:U('index?category_id='.$k)}">{$vo}</a>
						</volist>
					</div>
				</div>
			</div>
			<div class="kh_fl_3">
				<label>跟进状态：</label>
				<div>
					<div>
						<a href="">全部</a>
						<volist name=":C('CUSTOMER_FOLLOW_STATUS')" id="vo" key="k">
							<a class="" href="{:U('index?follow_status='.$k)}">{$vo}</a>
						</volist>
					</div>
				</div>
			</div>
		</div>
		<div class="kh_e">
			<span><span>已选</span><span class="yixuan"> 0 </span>位客户</span>

			<div class="btn-group">
				<div class="kh_e_a">
					<button class="btn ajax-post list_sort va" url="{:U('Batchshift',array('cate_id'=>$cate_id,'pid'=>I('pid',0)),'')}">发起协作</button>

					<button class="btn ajax-post va" target-form="ids" url="{:U(" Article/move ")}">移动至公海</button>
					<button class="btn ajax-post list_sort va" url="{:U('Multiedit',array('cate_id'=>$cate_id,'pid'=>I('pid',0)),'')}">批量编辑</button>

				</div>

				</button>

				<input type="hidden" class="hide-data va" name="cate_id" value="{$cate_id}" />
				<input type="hidden" class="hide-data va" name="pid" value="{$pid}" />
				<button class="btn ajax-post confirm va" target-form="ids" url="{:U(" Article/setStatus ",array("status "=>-1))}">删除多选</button>
				<button class="btn document_add" url="/crm/admin.php?s=/article/add/cate_id/2/pid/0/model_id/2.html">新增客户</button>

			</div>

		</div>
		<div class="fl">

			<!-- 高级搜索 -->

		</div>

		<!-- 数据表格 -->
		<div class="data-table">
			<table>
				<!-- 表头 -->
				<thead>
					<tr>
						<th class="row-selected row-selected">
							<input class="check-all" type="checkbox">
						</th>
						<th>客户姓名</th>
						<th>客户类型</th>
						<th>手机</th>
						<th>创建时间</th>
						<th>负责人</th>
						<th>跟进状态</th>
						<th>最新跟进记录</th>
						<th>协作发起人</th>
						<volist name="list_grids" id="field">
							<th>{$field.title}</th>
						</volist>
						<th>操作</th>
					</tr>
				</thead>

				<!-- 列表 -->
				<tbody>
					<volist name="list" id="data">
						<tr>
							<td><input class="ids" type="checkbox" value="{$data['id']}" name="ids[]"></td>
							<volist name="list_grids" id="grid">
								<td>{:get_list_field($data,$grid)}</td>
							</volist>
						</tr>
					</volist>

					<tr>
						<td><input class="ids" type="checkbox" value="1" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="2" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="3" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="4" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="5" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="6" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="7" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="8" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="9" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="10" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="11" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>
					<tr>
						<td><input class="ids" type="checkbox" value="12" name="ids[]"></td>
						<td>1</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">OneThink1.1开发版发布</a>
						</td>
						<td>主题</td>
						<td>2014-07-22 11:56</td>
						<td>正常</td>
						<td>正常</td>
						<td>正常</td>
						<td>8</td>
						<td>
							<a href="/crm/admin.php?s=/Article/edit/id/1/model/1/cate_id/2.html">编辑</a>
							<a href="/crm/admin.php?s=/Article/setstatus/status/-1/ids/1.html">删除</a>
						</td>
					</tr>

				</tbody>
			</table>
		</div>
		<!-- 分页 -->
		<div class="page">
			{$_page}
		</div>
	</div>

</block>
<block name="script">
	<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
	<php>if(C('COLOR_STYLE')=='blue_color') echo '
		<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
	<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
	<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
	<script type="text/javascript">
		$(function() {

			$(".va").click(function() {

				return false;
				alert("ss")
				var len = $("input.ids:checkbox:checked").length;
				if(len == 0) {

				}
			})

			$(".ids,.check-all").click(function() {
				var len = $("input.ids:checkbox:checked").length;

				$(".yixuan").html(len)

			})

			//搜索功能
			$("#search").click(function() {
				var url = $(this).attr('url');
				var status = $("#sch-sort-txt").attr("data");
				var query = $('.search-form').find('input').serialize();
				query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
				query = query.replace(/^&/g, '');
				if(status != '') {
					query = 'status=' + status + "&" + query;
				}
				if(url.indexOf('?') > 0) {
					url += '&' + query;
				} else {
					url += '?' + query;
				}
				window.location.href = url;
			});

			/* 状态搜索子菜单 */
			$(".search-form").find(".drop-down").hover(function() {
				$("#sub-sch-menu").removeClass("hidden");
			}, function() {
				$("#sub-sch-menu").addClass("hidden");
			});
			$("#sub-sch-menu li").find("a").each(function() {
				$(this).click(function() {
					var text = $(this).text();
					$("#sch-sort-txt").text(text).attr("data", $(this).attr("value"));
					$("#sub-sch-menu").addClass("hidden");
				})
			});

			//只有一个模型时，点击新增
			$('.document_add').click(function() {
				var url = $(this).attr('url');
				if(url != undefined && url != '') {
					window.location.href = url;
				}
			});

			//点击排序
			$('.list_sort').click(function() {
				var url = $(this).attr('url');
				var ids = $('.ids:checked');
				var param = '';
				if(ids.length > 0) {
					var str = new Array();
					ids.each(function() {
						str.push($(this).val());
					});
					param = str.join(',');
				}

				if(url != undefined && url != '') {
					window.location.href = url + '/ids/' + param;
				}
			});

			//回车自动提交
			$('.search-form').find('input').keyup(function(event) {
				if(event.keyCode === 13) {
					$("#search").click();
				}
			});

			$('#time-start').datetimepicker({
				format: 'yyyy-mm-dd',
				language: "zh-CN",
				minView: 2,
				autoclose: true
			});

			$('#time-end').datetimepicker({
				format: 'yyyy-mm-dd',
				language: "zh-CN",
				minView: 2,
				autoclose: true
			});
		})
	</script>
</block>